#ifndef QQ_ENTRY_VIEW
#define QQ_ENTRY_VIEW

#include <qdatetime.h>
#include <qdialog.h>
#include <qdialogbuttonbox.h>
#include <qlayout.h>
#include <qstackedlayout.h>
#include <qvalidator.h>

#include <ElaAppBar.h>
#include <ElaComboBox.h>
#include <ElaIconButton.h>
#include <ElaInteractiveCard.h>
#include <ElaLineEdit.h>
#include <ElaMessageBar.h>
#include <ElaPushButton.h>

#include "api/QQSystemApi.h"

#include "core/QQSettings.h"

class QQEntryView : public QDialog
{
	Q_OBJECT
public:
	QQEntryView(QWidget* parent = nullptr);
	~QQEntryView();

	void loadLoggedInfo(QPixmap pixmap, const QString& account, const QString& password);
	void showMessageBar(const QString& message);
signals:
	void entryInfoSubmit(const QString& account, const QString& password);
	void registerInfoSubmit(const QString& nickname, const QString& phone, const QString& password);
	void findPasswordInfoSubmit(const QString& account, const QString& phone);
protected:
	Q_TAKEOVER_NATIVEEVENT_H
private slots:
	void doEntryInfoSubmit();
	void doRegisterInfoSubmit();
	void doFindPasswordInfoSubmit();
	void doRefreshRcode();
	void doChangeView(QAbstractButton* button);
private:
	QStackedLayout* mLayout;
	ElaAppBar* mAppBar;

	ElaIconButton* mAvatar;
	ElaLineEdit* mLoginAccount;
	ElaLineEdit* mLoginPassword;
	ElaPushButton* mLoginButton;
	QDialogButtonBox* mLoginOption;

	ElaLineEdit* mRegisterNickname;
	ElaLineEdit* mRegisterNumber;
	ElaLineEdit* mRegisterPassword;
	ElaPushButton* mRegisterButton;
	QDialogButtonBox* mRegisterOption;

	ElaLineEdit* mFindPasswordAccount;
	ElaLineEdit* mFindPasswordNumber;
	ElaPushButton* mFindPasswordButton;
	QDialogButtonBox* mFindPasswordOption;

	ElaInteractiveCard* mRcodeImage;
	QDialogButtonBox* mRcodeOption;
};

#endif // QQ_ENTRY_VIEW